package com.blockchain.console.servlets.trading.jysc;

import java.math.BigDecimal;
import java.sql.Timestamp;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.blockchain.common.enums.IsPass;
import com.blockchain.console.service.trading.TradingManage;
import com.blockchain.console.service.trading.entity.JyscEntity;
import com.blockchain.console.service.trading.query.JyscQuery;
import com.blockchain.console.servlets.trading.AbstractTradingServlet;
import com.blockchain.framework.http.servlet.annotation.Right;
import com.blockchain.framework.service.ServiceSession;
import com.blockchain.framework.service.query.Paging;
import com.blockchain.framework.service.query.PagingResult;
import com.blockchain.util.parser.IntegerParser;
import com.blockchain.util.parser.TimestampParser;

@Right(id = "C_TRADING_JYSCLIST", isMenu = true, name = "市场管理")
public class JyscList extends AbstractTradingServlet {

	private static final long serialVersionUID = 1L;

	@Override
	protected void processGet(HttpServletRequest request, HttpServletResponse response, ServiceSession serviceSession)
			throws Throwable {
		processPost(request, response, serviceSession);
	}

	@Override
	protected void processPost(final HttpServletRequest request, final HttpServletResponse response,
			final ServiceSession serviceSession) throws Throwable {
		TradingManage tsradingManage = serviceSession.getService(TradingManage.class);
		PagingResult<JyscEntity> jyscs = tsradingManage.jyscSearch(new JyscQuery() {
			
			@Override
			public int getXsws() {
				return 0;
			}
			
			@Override
			public int getSlxsws() {
				return 0;
			}
			
			@Override
			public IsPass getSfxs() {
				return null;
			}
			
			@Override
			public IsPass getSfkqjy() {
				return null;
			}
			
			@Override
			public BigDecimal getMr_zxj() {
				return null;
			}
			
			@Override
			public BigDecimal getMr_zdj() {
				return null;
			}
			
			@Override
			public BigDecimal getMr_sxf() {
				return null;
			}
			
			@Override
			public int getMr_bz() {
				return 0;
			}
			
			@Override
			public BigDecimal getMc_zxj() {
				return null;
			}
			
			@Override
			public BigDecimal getMc_zdj() {
				return null;
			}
			
			@Override
			public BigDecimal getMc_sxf() {
				return null;
			}
			
			@Override
			public int getMc_bz() {
				return 0;
			}
			
			@Override
			public int getFqid() {
				return 0;
			}
			
			@Override
			public Timestamp getCreateTimeStart() {
				return TimestampParser.parse(request.getParameter("start"));
			}

			@Override
			public Timestamp getCreateTimeEnd() {
				return TimestampParser.parse(request.getParameter("end"));
			}
		},new Paging() {

			@Override
			public int getSize() {
				return 10;
			}

			@Override
			public int getCurrentPage() {
				return IntegerParser.parse(request.getParameter(PAGING_CURRENT));
			}
		});
		request.setAttribute("jyscs", jyscs);
		forwardView(request, response, getClass());
	}

}
